package com.thirteen.app.controller;

import com.thirteen.app.service.QuestionService;
import com.thirteen.app.utils.tools.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.oas.annotations.EnableOpenApi;

import javax.annotation.Resource;

@CrossOrigin
@Api(tags = "错题管理模块")
@EnableOpenApi
@RestController
@RequestMapping("/api/student/wrongQu")
public class WrongQuestionController {
    @Resource
    private QuestionService questionService;

    @GetMapping("selectAll")
    @ApiOperation("获取错题列表")
    public CommonResult selectAll(Integer examRecordId,String content) {
        return CommonResult.success(questionService.selectAllWrongQuestions(examRecordId,content));
    }

    @PostMapping("deleteWrongQuestion")
    @ApiOperation("删除错题")
    public CommonResult deleteWrongQu(Integer questionId, Integer examRecordId) {
        System.out.println(examRecordId);
        System.out.println(questionId);
        return CommonResult.success(questionService.deleteWrongQu(questionId, examRecordId));
    }
}
